package com.jiukuaidao.zhulin.module.pay.alipay;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.jiukuaidao.library.base.BaseActivity;
import com.jiukuaidao.library.util.ToastUtil;
import com.jiukuaidao.zhulin.AppContext;
import com.jiukuaidao.zhulin.R;
import com.jiukuaidao.zhulin.data.TaskProvider;
import com.jiukuaidao.zhulin.entity.ApiGeoCoderInfo;
import com.jiukuaidao.zhulin.expand.baidu.ICallBack;
import com.jiukuaidao.zhulin.expand.baidu.webapi.Geocoding;

/**
 * Author : PaiTaSuo
 * Date : 2016/5/13
 * Description : 支付宝支付
 */
public class PaydemoActivity extends BaseActivity<PayContract.Presenter> implements View.OnClickListener, PayContract.View {
    private Button mPayBtn;

    @Override
    protected View getTargetView() {
        return null;
    }

    @Override
    protected int getEnterDirection() {
        return LEFT;
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.pay_main;
    }

    @Override
    protected void handleBundle(Bundle bundle) {

    }

    @Override
    protected void init() {
        mPayBtn = (Button) findViewById(R.id.pay);
        new PayPresenter(TaskProvider.provideTasksRepository(this), this);

        mPayBtn.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.pay:
                Geocoding.geocoding(12.112, 125.00, new ICallBack<ApiGeoCoderInfo>() {
                    @Override
                    public void onSuccess(ApiGeoCoderInfo apiGeoCoderInfo) {

                    }

                    @Override
                    public void onFailed(String errorMsg) {

                    }
                });
//                mPresenter.pay();
                break;
        }
    }

    @Override
    public void toast(String msg) {
        ToastUtil.show(msg,Toast.LENGTH_SHORT);
    }

    @Override
    public String getSubiect() {
        return "测试的商品";
    }

    @Override
    public String getBody() {
        return "该测试商品的详细描述";
    }

    @Override
    public String getPrice() {
        return "0.01";
    }

    @Override
    public Context getContext() {
        return AppContext.getContext();
    }

}
